package com.csy.user.controller.system;

import com.csy.commons.core.controller.BaseController;
import com.csy.commons.core.domain.BaseResponse;
import com.csy.commons.core.page.PageResult;
import com.csy.user.entity.system.domain.SysLifepay;
import com.csy.user.entity.system.service.SysLifepayService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 *
 */
@RestController
@RequestMapping("system/lifepay")
public class SysLifepayController extends BaseController {

    @Resource
    private SysLifepayService sysLifepayService;

    /**
     * 查询生活缴费列表
     * @param sysLifepay
     * @return
     */
    @GetMapping("/list")
    public PageResult list(SysLifepay sysLifepay){
        startPage();
        List<SysLifepay> list = sysLifepayService.selectLifepayList(sysLifepay);
        return getData(list);
    }
    /*
     * 新增
     * */
    @PostMapping
    public BaseResponse<Integer> add(@RequestBody SysLifepay sysLifepay) {
        return toAjax(sysLifepayService.insertLifepay(sysLifepay));
    }

    /*
     * 修改
     * */
    @PutMapping
    public BaseResponse<Integer> edit(@RequestBody SysLifepay sysLifepay) {
        return toAjax(sysLifepayService.updateLifepay(sysLifepay));
    }

}
